package chapter04.d1_fileio.demo3;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: jack_yang
 * @Date: 2024/5/8
 * @Description: addition and subtraction
 */
public class Student implements Serializable {

    private String name;
    private int id;
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    public Student(){

    }
    public Student(int id, String name){
        this.name=name;
        this.id=id;
    }

    @Override
    public String toString() {
        return id + " " + name;
    }

    public static List<Student> getStudentList(){
        ArrayList<Student> arrayList = new ArrayList<>();
        Student student1 = new Student(1,"老王" );
        Student student2 = new Student( 2,"老李");
        Student student3 = new Student( 3,"老张");
        arrayList.add(student1);
        arrayList.add(student2);
        arrayList.add(student3);
        return arrayList;
    }
}
